package com.njym.java.security.app.biz;

import com.njym.java.security.app.entity.PersonalJournal;
import com.njym.java.security.app.mapper.PersonalJournalMapper;
import com.njym.java.security.common.biz.BaseBiz;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 
 *
 * @author lijie
 * @email 717057076@qq.com
 * @date 2019-11-26 09:23:13
 */
@Service
public class PersonalJournalBiz extends BaseBiz<PersonalJournalMapper,PersonalJournal> {

    @Resource
    private PersonalJournalMapper personalJournalMapper;

    public List<PersonalJournal> getLists(int userId){
        List<PersonalJournal> list =  personalJournalMapper.getLists(userId);
        return list;
    }

    public int deleteJournal(int id, int userId){
        return personalJournalMapper.deleteLogicaly(id, userId);
    }

    public int addJournal(String title, String content, int createUser, int isShow){
        PersonalJournal entity = new PersonalJournal();
        entity.setTitle(title);
        entity.setContent(content);
        entity.setCreateTime(new Date());
        entity.setCreateUser(createUser);
        entity.setDeleted(0);
        entity.setIsShow(isShow);
        return personalJournalMapper.insertSelective(entity);
    }
}